<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"gongxicheng.cn","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta property="og:type" content="website">
<meta property="og:title" content="恭喜">
<meta property="og:url" content="gongxicheng.cn/page/3/index.html">
<meta property="og:site_name" content="恭喜">
<meta property="og:locale" content="zh_CN">
<meta property="article:author" content="Gary Gong">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="gongxicheng.cn/page/3/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : true,
    isPost : false,
    lang   : 'zh-CN'
  };
</script>

  <title>恭喜</title>
  
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-123017381-1"></script>
    <script>
      if (CONFIG.hostname === location.hostname) {
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('js', new Date());
        gtag('config', 'UA-123017381-1');
      }
    </script>






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">恭喜</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content index posts-expand">
            
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="gongxicheng.cn/2018/07/25/before2020/2018-07-25-c-sharp-concurrentdictionary-use/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="Gary Gong">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="恭喜">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2018/07/25/before2020/2018-07-25-c-sharp-concurrentdictionary-use/" class="post-title-link" itemprop="url">C# ConcurrentDictionary 的使用</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2018-07-25 17:51:05" itemprop="dateCreated datePublished" datetime="2018-07-25T17:51:05+00:00">2018-07-25</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-12-03 05:23:42" itemprop="dateModified" datetime="2020-12-03T05:23:42+00:00">2020-12-03</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h1 id="我的问题"><a href="#我的问题" class="headerlink" title="我的问题"></a>我的问题</h1><p>在编码中没有注意Dictionary 是非线程安全的，以及对当前的注入的实例化的注入方式没有关注。结果在实现一个逻辑的时候在类中定义了一个 private 的 Dictionary ，结果导致有几率会导致当前县城 hang 住，我不确定为什么会导致方法 hang 住，而不是抛异常，这个问题是同事分析 dump 文件之后返回来的。所以对这个问题的根本原因还没有找到，google 了Dictionary 线程不安全的现象，也没有找到具体有人说过。自己写了test的代码，现象也是会抛异常而不是卡住。所以这个算是一个没有找到原因的现象。</p>
<p>无论是不是Dictionary 导致的hang， 这个地方的Dictionary会有线程安全问题是铁定的了。所以这个地方需要修正，能想到的方案有两个</p>
<h2 id="方案1-Dictionary-lock"><a href="#方案1-Dictionary-lock" class="headerlink" title="方案1 Dictionary + lock"></a>方案1 Dictionary + lock</h2><h2 id="方案2-不要声明类的的私有属性"><a href="#方案2-不要声明类的的私有属性" class="headerlink" title="方案2 不要声明类的的私有属性"></a>方案2 不要声明类的的私有属性</h2><p>但是领导说让使用 ConcurrentDictionary，这就牵扯出来ConcurrentDictionary 的使用的问题。</p>
<h1 id="ConcurrentDictionary-出现"><a href="#ConcurrentDictionary-出现" class="headerlink" title="ConcurrentDictionary 出现"></a>ConcurrentDictionary 出现</h1><h1 id="ConcurrentDictionary-使用"><a href="#ConcurrentDictionary-使用" class="headerlink" title="ConcurrentDictionary 使用"></a>ConcurrentDictionary 使用</h1><h1 id="ConcurrentDictionary-问题"><a href="#ConcurrentDictionary-问题" class="headerlink" title="ConcurrentDictionary 问题"></a>ConcurrentDictionary 问题</h1>
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="gongxicheng.cn/2018/07/14/before2020/2018-07-14-EFCoreNETcommand-linetools/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="Gary Gong">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="恭喜">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2018/07/14/before2020/2018-07-14-EFCoreNETcommand-linetools/" class="post-title-link" itemprop="url">EF Core .NET Command-line Tools </a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2018-07-14 17:51:05" itemprop="dateCreated datePublished" datetime="2018-07-14T17:51:05+00:00">2018-07-14</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-12-03 05:23:42" itemprop="dateModified" datetime="2020-12-03T05:23:42+00:00">2020-12-03</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h1 id="初始化数据库"><a href="#初始化数据库" class="headerlink" title="初始化数据库"></a>初始化数据库</h1><p>最近想看看ABP的代码，所以下载了一份代码，然后按照官方的的流程很容易就启动起来了。然后就回家折腾一下，结果回家就没那么轻松了，家里电脑有两台，分别是mac 和win10，对mac不是很熟悉，所以优先弄了下win10上的。<br>但是在win10中，在Package manager console 中运行update-database的时候会出现错误，错误内容是</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">   It was not possible to find any compatible framework version</span><br><span class="line">The specified framework &#39;Microsoft.NETCore.App&#39;, version &#39;2.1.0&#39; was not found.</span><br></pre></td></tr></table></figure>
<p>同样的代码，在公司只有一个警告，说的也是这块版本不太匹配，但是在家直接失败，这样会导致数据库初始化失败。但是没有研究，竟然不通，就先去mac上下载了代码，安装 mariadb，这里需要提到一点，想让maradb可以远程访问需要设置密码，在apply的时候注意填写密码，否则无法在其他机器上访问这个db。</p>
<p>记录下本次最在意的一点，.net core 的 ef 再mac上可以使用 dotnet 命令来进行数据库的初始化操作。具体使用command的 <a href="https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/dotnet" target="_blank" rel="noopener">链接</a><br>具体命令：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">dotnet ef database update</span><br></pre></td></tr></table></figure>

<p>这命令也可以在win10 中运行，并且没有错误提示。完美绕过了 pcm的错误。<br>还是不会写文章，只是记录下自己经历中印象略深的。</p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="gongxicheng.cn/2018/07/14/before2020/2018-07-14-justfortest/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="Gary Gong">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="恭喜">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2018/07/14/before2020/2018-07-14-justfortest/" class="post-title-link" itemprop="url">测试</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2018-07-14 00:02:15" itemprop="dateCreated datePublished" datetime="2018-07-14T00:02:15+00:00">2018-07-14</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-12-03 05:23:42" itemprop="dateModified" datetime="2020-12-03T05:23:42+00:00">2020-12-03</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h1 id="test-travis-CI-and-IO-page"><a href="#test-travis-CI-and-IO-page" class="headerlink" title="test travis CI and IO page"></a>test travis CI and IO page</h1>
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="gongxicheng.cn/2018/06/29/before2020/2018-06-29-propertyreturnarry/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="Gary Gong">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="恭喜">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2018/06/29/before2020/2018-06-29-propertyreturnarry/" class="post-title-link" itemprop="url">避免属性返回数组</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2018-06-29 00:00:00" itemprop="dateCreated datePublished" datetime="2018-06-29T00:00:00+00:00">2018-06-29</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-12-03 05:23:42" itemprop="dateModified" datetime="2020-12-03T05:23:42+00:00">2020-12-03</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h1 id="问题"><a href="#问题" class="headerlink" title="问题"></a>问题</h1><p>通常返回内部数组的副本是必需的，这样用户就无法改变对象的内部状态。但这会导致代码的效率十分低下。</p>
<p>下面的例子中，在循环的每次迭代过程中 <code>Employees</code> 属性被访问了两次。下面这一小段代码就会产生2n+1个副本：</p>
<pre><code>Company microsoft = GetCompanyData(&quot;MSFT&quot;);
for(int i = 0 ; i &lt; microsoft.Employess.Lengthh; i++){
    if(microsotf.Employess[i].Alias == &quot;kcwalina&quot;){
    ...
    }
}</code></pre><h1 id="解决方案"><a href="#解决方案" class="headerlink" title="解决方案"></a>解决方案</h1><p>这个问题可以通过以下两种方式解决。</p>
<p>一种方式是把属性改为方法，这可以告诉调用者该操作不只是访问内部字段，还有可能在每次调用时创建一个数组。这样一来，用户很可能只调用一次该方法，把结果暂时保存起来，并对保存的结果进行操作。</p>
<pre><code>Company microsoft =GetCompanyData(&quot;MSFT&quot;);
Employees[] employees = microsoft.GetEmployees();
for(int i = 0 ; i &lt; employees.Length; i++){
    if(employees[i].Alias == &quot;kcwalina&quot;){
    ...
    }
}</code></pre><p>另一种方式是把属性的返回值改成集合而不要用数组。我们可以用’REadOnlyCollection<T>‘以只读的形式来公开提供对私有数据的访问。或者，我们也可以用’Collection<T>‘的子类来提供受控的读写访问，这样在用户的代码修改集合时，我们就能得到通知。</p>
<pre><code>pulic ReadOnlyCOllection&lt;Employees&gt; Employees{
    get {return roEmployees; }
}
private Employee[] employees;
private ReadOnlyCollection&lt;Employees&gt; roEmployees;</code></pre>
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="gongxicheng.cn/2018/06/28/before2020/2018-06-28-sheepcountquestion/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="Gary Gong">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="恭喜">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2018/06/28/before2020/2018-06-28-sheepcountquestion/" class="post-title-link" itemprop="url">多少只羊的面试小问题</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2018-06-28 03:32:15" itemprop="dateCreated datePublished" datetime="2018-06-28T03:32:15+00:00">2018-06-28</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-12-03 05:23:42" itemprop="dateModified" datetime="2020-12-03T05:23:42+00:00">2020-12-03</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h1 id="问题"><a href="#问题" class="headerlink" title="问题"></a>问题</h1><p>小羊能活5岁，它在2岁，4岁的时候都会生一只小羊，5岁的时候就死亡了。<br>问：现在有一只刚出生的小羊(0岁),n年后有多少只羊？</p>
<h1 id="回答"><a href="#回答" class="headerlink" title="回答"></a>回答</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">int zeroSheepCount &#x3D; 1, sheep1Count&#x3D;0 , sheep2Count&#x3D;0, sheep3Count&#x3D;0, sheep4Count&#x3D;0, sheep5Count&#x3D;0;</span><br><span class="line">          for (int i &#x3D; 0; i &lt; 10; i++)</span><br><span class="line">          &#123;</span><br><span class="line">              sheep5Count &#x3D; sheep4Count;</span><br><span class="line">              sheep4Count &#x3D; sheep3Count;</span><br><span class="line">              sheep3Count &#x3D; sheep2Count;</span><br><span class="line">              sheep2Count &#x3D; sheep1Count;</span><br><span class="line">              sheep1Count &#x3D; zeroSheepCount;</span><br><span class="line"></span><br><span class="line">               var newSheep &#x3D; sheep2Count + sheep4Count;</span><br><span class="line">              zeroSheepCount &#x3D; newSheep;</span><br><span class="line">          &#125;</span><br><span class="line">          var allCount &#x3D; zeroSheepCount + sheep1Count + sheep2Count + sheep3Count + sheep4Count + sheep5Count;</span><br><span class="line">          Console.WriteLine(allCount);</span><br></pre></td></tr></table></figure>

<p>常见的处理方式都会弄出来一个羊的对象，然后记录年龄，判断年龄。这样能够解决这个问题，但是羊的数量增加的很快，50年的时候内存已经增加明显，所以这个方法就不会有内存这方面的问题。</p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="gongxicheng.cn/2018/06/17/before2020/2018-06-17-Stringnote/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="Gary Gong">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="恭喜">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2018/06/17/before2020/2018-06-17-Stringnote/" class="post-title-link" itemprop="url">String注意点</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2018-06-17 23:15:54" itemprop="dateCreated datePublished" datetime="2018-06-17T23:15:54+00:00">2018-06-17</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-12-03 05:23:42" itemprop="dateModified" datetime="2020-12-03T05:23:42+00:00">2020-12-03</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h1 id="字符串换行"><a href="#字符串换行" class="headerlink" title="字符串换行"></a>字符串换行</h1> <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">System.Console.WriteLine($@&quot;Your full name is : &#123;</span><br><span class="line">            firstName&#125; &#123;lastName&#125;&quot;);</span><br></pre></td></tr></table></figure>
<pre><code>很好的点，可能不高级，但是看了觉着很好。</code></pre><h1 id="using-static"><a href="#using-static" class="headerlink" title="using static"></a>using static</h1><pre><code class="C#"><span class="keyword">using</span> <span class="keyword">static</span> System.Console;
    <span class="keyword">class</span> <span class="title">Program</span>
    {
        <span class="function"><span class="keyword">static</span> <span class="keyword">void</span> <span class="title">Main</span>(<span class="params"><span class="keyword">string</span>[] args</span>)</span>
<span class="function"></span>        {
            WriteLine(<span class="string">"Hello World!"</span>);
        }
}</code></pre>
<p>C# 6.0的新写法</p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="gongxicheng.cn/2018/06/17/before2020/2018-06-17-C-sharp-int-and-decimal/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="Gary Gong">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="恭喜">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2018/06/17/before2020/2018-06-17-C-sharp-int-and-decimal/" class="post-title-link" itemprop="url">C#数字</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2018-06-17 17:51:05" itemprop="dateCreated datePublished" datetime="2018-06-17T17:51:05+00:00">2018-06-17</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-12-03 05:23:42" itemprop="dateModified" datetime="2020-12-03T05:23:42+00:00">2020-12-03</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h1 id="浮点数"><a href="#浮点数" class="headerlink" title="浮点数"></a>浮点数</h1><p>浮点数的精度是可变的。除非用分数表示时分母恰好是2的正数次幂，否则用二进制浮点类型无法准确的表示该数。0.1 会有可能会表示成0.99999999999或1.000000000001.</p>
<p>decimal类型保证范围内的所有十进制数都是精确的。所以，对于decimal类型来说，0.1就是0.1而不是一个近似值。虽然decimal具有比浮点类型更高的精度，但是它的范围较小，所以，从浮点类型转换为decimal类型可能发生溢出错误。</p>
<h1 id="Round-trip格式化"><a href="#Round-trip格式化" class="headerlink" title="Round-trip格式化"></a>Round-trip格式化</h1><p>1.618033988749895 在Console.WriteLine($”{1.618033988749895}”)无法显示完全，最后一位会丢失。可以使用 string.Format(“{0:R}”,1.618033988749895)会返回结果1.618033988749895。 </p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="gongxicheng.cn/2018/06/07/before2020/2018-06-07-deploy-hexo-again-after-two-year/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="Gary Gong">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="恭喜">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2018/06/07/before2020/2018-06-07-deploy-hexo-again-after-two-year/" class="post-title-link" itemprop="url">纪念一下两年了又想折腾hexo</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2018-06-07 15:22:36" itemprop="dateCreated datePublished" datetime="2018-06-07T15:22:36+00:00">2018-06-07</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-12-03 05:23:42" itemprop="dateModified" datetime="2020-12-03T05:23:42+00:00">2020-12-03</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p>以下内容复制转载<br><a href="https://segmentfault.com/a/1190000009054888" target="_blank" rel="noopener">原网址</a></p>
<p>因为之前留着链接，结果过一段时间之后，链接就失效了。所以打算把内容都粘上备着。</p>
<blockquote>
<p>该文写给爱折腾的人，对纯新手不友善，没有辣么详细地说明如何安装node、git或者是hexo，所以关于这些问题可先行<code>google</code>，如有其它问题请在这里或者我的<a href="http://www.jianshu.com/p/1226d159d514" target="_blank" rel="noopener">简书</a>上留言</p>
</blockquote>
<p>使用<code>hexo</code>而不使用<code>jekyll</code>在github上搭blog最大的问题就是，每次提交都需要先<code>hexo g</code>，然后再<code>push</code>生成的文件们，这样哪怕是改一个小的地方都需要重新编译全部blog，想想都蛋疼（虽然我还没有多少文章），所以决定使用<a href="https://travis-ci.org/" target="_blank" rel="noopener">Travis</a>来自动持续集成提交到github以后的操作</p>
<p>网上一搜有很多的教程，看了好多然后东拼西凑才最终成功，遂决定记录下来最终成功的这个方法，以免忘记</p>
<p>本文中实现的最终效果是：</p>
<ul>
<li>写完blog后，直接<code>push</code>到github的<code>source</code>分支，其它的就可以不用管了</li>
<li>由于我的<code>.travis.yml</code>配置文件里设置监听的就是<code>source</code>分支，所以会触发<code>webhook</code></li>
<li><code>Travis</code>则会将该项目<code>clone</code>过去，然后按照<code>.travis.yml</code>的设置执行接下来的命令</li>
<li>执行完成后，再将编译好的文件们发送到自己的服务器，顺便<code>push</code>回<code>master</code>分支上来</li>
<li>这样就可以在<a href="http://blog.godi13.com" target="_blank" rel="noopener">blog.godi13.com</a>和<a href="http://godi13.github.io/" target="_blank" rel="noopener">Godi13.github.io</a>上都访问blog了</li>
</ul>
<h1 id="Github"><a href="#Github" class="headerlink" title="Github"></a>Github</h1><p>首先，按规定名称<code>XXXXX.github.io</code>，其中<code>XXXXX</code>为你的用户名，如下图中的<code>Godi13.github.io</code>创建项目</p>
<p><img src="http://images.godi13.com/2017-04-10-githubio.png-total" alt="创建github项目"></p>
<p>为了使<code>travis</code>能够将编译好的文件们<code>push</code>回咱们的github，我们需要生成<code>token</code>，步骤如下：</p>
<p>1) 点击右上方头像，然后点<code>setting</code></p>
<p><img src="http://images.godi13.com/2017-04-10-setting.png-small" alt="githubsetting"></p>
<p>2) 点击<code>Personal access tokens</code></p>
<p><img src="http://images.godi13.com/2017-04-10-token.png-small" alt=""></p>
<p>3) 点击<code>Generate new token</code></p>
<p>![](<a href="http://images.godi13.com/2017-04-10-token2.png" target="_blank" rel="noopener">http://images.godi13.com/2017-04-10-token2.png</a><br>-total)</p>
<p>4) 为<code>token</code>起一个名字，勾选<code>repo</code>，然后点击生成</p>
<p>![](<a href="http://images.godi13.com/2017-04-10-repo.png" target="_blank" rel="noopener">http://images.godi13.com/2017-04-10-repo.png</a><br>-total)</p>
<div class="tip">生成`token`以后，一定要复制好，因为只显示一次，如果丢失只能再次生成了</div>

<p><img src="http://images.godi13.com/2017-04-10-copytoken.png" alt=""></p>
<h1 id="Travis"><a href="#Travis" class="headerlink" title="Travis"></a>Travis</h1><p>1) 使用<code>github</code>帐号登录<a href="https://travis-ci.org/" target="_blank" rel="noopener">Travis</a>，右上方按钮点击同步项目，下方打开需要集成的项目，最后点击齿轮进入项目配置页面</p>
<p><img src="http://images.godi13.com/2017-04-10-travisfirst.png" alt="在travis同步"></p>
<p>2) 打开<code>Build only if .travis.yml is present</code>，右下角的那个其实也可以关了，然后往下移动页面到环境变量</p>
<p><img src="http://images.godi13.com/2017-04-10-present.png" alt=""></p>
<p>3) 在这里我将变量名称名为<code>REPO_TOKEN</code>，放上<code>token</code>，点击<code>Add</code>按钮</p>
<p><img src="http://images.godi13.com/2017-04-10-value.png" alt=""></p>
<h1 id="Terminal"><a href="#Terminal" class="headerlink" title="Terminal"></a>Terminal</h1><p>回到终端，进入<code>blog</code>所在的文件夹下，新建<code>.travis.yml</code>文件，并添加以下内容</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 使用语言</span></span><br><span class="line"><span class="attr">language:</span> <span class="string">node_js</span></span><br><span class="line"><span class="comment"># node版本</span></span><br><span class="line"><span class="attr">node_js:</span> <span class="string">stable</span></span><br><span class="line"><span class="comment"># 设置只监听哪个分支</span></span><br><span class="line"><span class="attr">branches:</span></span><br><span class="line">  <span class="attr">only:</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">source</span></span><br><span class="line"><span class="comment"># 缓存，可以节省集成的时间，这里我用了yarn，如果不用可以删除</span></span><br><span class="line"><span class="attr">cache:</span></span><br><span class="line">  <span class="attr">apt:</span> <span class="literal">true</span></span><br><span class="line">  <span class="attr">yarn:</span> <span class="literal">true</span></span><br><span class="line">  <span class="attr">directories:</span></span><br><span class="line">    <span class="bullet">-</span> <span class="string">node_modules</span></span><br><span class="line"><span class="comment"># tarvis生命周期执行顺序详见官网文档</span></span><br><span class="line"><span class="attr">before_install:</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">git</span> <span class="string">config</span> <span class="string">--global</span> <span class="string">user.name</span> <span class="string">"Godi13"</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">git</span> <span class="string">config</span> <span class="string">--global</span> <span class="string">user.email</span> <span class="string">"mqzq9388@gmail.com"</span></span><br><span class="line"><span class="comment"># 由于使用了yarn，所以需要下载，如不用yarn这两行可以删除</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">curl</span> <span class="string">-o-</span> <span class="string">-L</span> <span class="string">https://yarnpkg.com/install.sh</span> <span class="string">|</span> <span class="string">bash</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">export</span> <span class="string">PATH=$HOME/.yarn/bin:$PATH</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">npm</span> <span class="string">install</span> <span class="string">-g</span> <span class="string">hexo-cli</span></span><br><span class="line"><span class="attr">install:</span></span><br><span class="line"><span class="comment"># 不用yarn的话这里改成 npm i 即可</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">yarn</span></span><br><span class="line"><span class="attr">script:</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">hexo</span> <span class="string">clean</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">hexo</span> <span class="string">generate</span></span><br><span class="line"><span class="attr">after_success:</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">cd</span> <span class="string">./public</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">git</span> <span class="string">init</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">git</span> <span class="string">add</span> <span class="string">--all</span> <span class="string">.</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">git</span> <span class="string">commit</span> <span class="string">-m</span> <span class="string">"Travis CI Auto Builder"</span></span><br><span class="line"><span class="comment"># 这里的 REPO_TOKEN 即之前在 travis 项目的环境变量里添加的</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">git</span> <span class="string">push</span> <span class="string">--quiet</span> <span class="string">--force</span> <span class="string">https://$REPO_TOKEN@github.com/Godi13/Godi13.github.io.git</span></span><br><span class="line">  <span class="string">master</span></span><br></pre></td></tr></table></figure>

<p>然后，准备<code>push</code>该项目到github，看下是否成功，如果是新项目可参照下面的git指令</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">git init</span><br><span class="line"><span class="comment"># 添加自己的项目</span></span><br><span class="line">git remote add origin git@github.com:Godi13/Godi13.github.io.git</span><br><span class="line"><span class="comment"># 新建并切换分支</span></span><br><span class="line">git checkout --orphan <span class="built_in">source</span></span><br><span class="line">git add -A</span><br><span class="line">git commit -m <span class="string">"Travis CI"</span></span><br><span class="line">git push</span><br></pre></td></tr></table></figure>

<blockquote>
<p>关于 <code>--orphan</code> 请参考 <a href="https://ihower.tw/blog/archives/5691" target="_blank" rel="noopener">如何建立一個沒有 Parent 的獨立 Git branch</a></p>
</blockquote>
<p>如最终成功则会看到</p>
<p><img src="http://images.godi13.com/2017-04-10-success.png" alt=""></p>
<p>到这里关于hexo和github的事情就先吿一段落，接下来就是服务器与tarvis</p>
<h1 id="服务器"><a href="#服务器" class="headerlink" title="服务器"></a>服务器</h1><p>按照上面<code>.tarvis.yml</code>的设置，其实我只需要在<code>after_success</code>这个生命周期中，把<code>public</code>文件夹下的所有文件传送到服务器指定的路径即可，接下来就是解决如何让<code>tarvis</code>往我的服务器传东西的问题了</p>
<p>在此之前，你需要将本机生成的密钥传到服务器上</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">ssh-keygen -t rsa <span class="comment"># 然后一路回车即可</span></span><br><span class="line"><span class="comment"># ssh-copy-id 可能需要另行安装</span></span><br><span class="line"><span class="comment"># 如果ssh默认端口是22，则不需要 -p</span></span><br><span class="line">ssh-copy-id &lt;登录部署服务器用户名&gt;@&lt;部署服务器地址&gt; -p &lt;部署服务器ssh端口&gt;</span><br><span class="line">ssh &lt;登录部署服务器用户名&gt;@&lt;部署服务器地址&gt; -p &lt;部署服务器ssh端口&gt;</span><br></pre></td></tr></table></figure>

<p>如果登录服务器成功，接下来需要安装<code>travis</code>命令行工具</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 安装travis命令行工具，如无法使用gem指令须先安装ruby</span></span><br><span class="line">gem install travis</span><br><span class="line"><span class="comment"># --auto自动登录github帐号</span></span><br><span class="line">travis login --auto</span><br><span class="line"><span class="comment"># 此处的--add参数表示自动添加脚本到.travis.yml文件中</span></span><br><span class="line">travis encrypt-file ~/.ssh/id_rsa --add</span><br><span class="line"><span class="comment"># 这个命令会自动把 id_rsa 加密传送到 .git 指定的仓库对应的 travis 中去</span></span><br></pre></td></tr></table></figure>

<p>执行完以后会发现在<code>travis</code>网站项目里面的环境变量里多了两个参数</p>
<p><img src="http://images.godi13.com/2017-04-10-sshkey.png" alt=""></p>
<p>并且在<code>.travis.yml</code>里的<code>before_install</code>周期中多了下面这2行</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">- openssl aes-256-cbc -K <span class="variable">$encrypted_97d432d3ed20_key</span> -iv <span class="variable">$encrypted_97d432d3ed20_iv</span></span><br><span class="line">  -<span class="keyword">in</span> id_rsa.enc -out ~\/.ssh/id_rsa -d</span><br></pre></td></tr></table></figure>

<p>默认生成的命令可能会在<code>/</code>前面带转义符<code>\</code>，我们不需要这些转义符，手动删掉所有的转义符，否则可能在后面引发莫名的错误</p>
<p>之后为了保证命令的顺利运行，我们还需要正确地设置权限和认证</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">before_install</span><br><span class="line">- openssl aes-256-cbc -K <span class="variable">$encrypted_97d432d3ed20_key</span> -iv <span class="variable">$encrypted_97d432d3ed20_iv</span></span><br><span class="line">  -<span class="keyword">in</span> id_rsa.enc -out ~/.ssh/id_rsa -d</span><br><span class="line">- chmod 600 ~/.ssh/id_rsa</span><br><span class="line">- <span class="built_in">echo</span> -e <span class="string">"Host 主机IP地址\n\tStrictHostKeyChecking no\n"</span> &gt;&gt; ~/.ssh/config</span><br></pre></td></tr></table></figure>

<p>最后，就是在<code>after_success</code>周期中，添加上传服务器的指令即可，在这里要注意，如果没有<code>stricthostkeychecking=no</code>参数，将构建失败，详细原因请参考<a href="http://blog.csdn.net/qq8427003/article/details/64921238" target="_blank" rel="noopener">通过travis部署代码到远程服务器</a></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 由于我修改了默认的port，所以在这里也进行了加密处理</span></span><br><span class="line">- scp -o stricthostkeychecking=no -P <span class="variable">$PORT</span> -r public/* 用户@域名:/路径</span><br></pre></td></tr></table></figure>

<p>但使用<code>scp</code>有很多问题，所以后来我决定改用<code>rsync</code>命令，缺点是端口号就不能用travis环境来加密了，如果哪个朋友有更好的方案希望能告诉我，关于<code>rsync</code>请参考<a href="http://haoduoshipin.com/v/48.html" target="_blank" rel="noopener">介绍 rsync 数据同步工具</a></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># public 后面加上/即可将该目录下的文件都传送到服务器了</span></span><br><span class="line">- rsync -rv --delete -e <span class="string">'ssh -o stricthostkeychecking=no -p 端口号'</span> public/ 用户@域名:/路径</span><br></pre></td></tr></table></figure>

<p>最后在这里放上我最终的<a href="https://github.com/Godi13/Godi13.github.io/blob/source/.travis.yml" target="_blank" rel="noopener">.travis.yml</a>配置参数，希望本文对大家能有所帮助</p>
<h1 id="参考资料"><a href="#参考资料" class="headerlink" title="参考资料"></a>参考资料</h1><ul>
<li><a href="https://github.com/tommy351/tommy351.github.io/blob/source/.travis.yml" target="_blank" rel="noopener">Hexo作者的.travis.yml配置</a></li>
<li><a href="https://zespia.tw/blog/2015/01/21/continuous-deployment-to-github-with-travis/" target="_blank" rel="noopener">用 Travis CI 自動部署網站到 GitHub</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/25066056" target="_blank" rel="noopener">一点都不高大上，手把手教你使用Travis CI实现持续部署</a></li>
<li><a href="http://notes.iissnan.com/2016/publishing-github-pages-with-travis-ci/" target="_blank" rel="noopener">使用 Travis CI 自动更新 GitHub Pages</a></li>
<li><a href="http://magicse7en.github.io/2016/03/27/travis-ci-auto-deploy-hexo-github/" target="_blank" rel="noopener">使用Travis CI自动构建hexo博客</a></li>
</ul>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="gongxicheng.cn/2016/10/15/before2020/2016-10-15-visual-studoi-code-keyboard-shortcuts/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="Gary Gong">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="恭喜">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2016/10/15/before2020/2016-10-15-visual-studoi-code-keyboard-shortcuts/" class="post-title-link" itemprop="url">visual studoi code 常用快捷键</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2016-10-15 19:12:20" itemprop="dateCreated datePublished" datetime="2016-10-15T19:12:20+00:00">2016-10-15</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-12-03 05:23:42" itemprop="dateModified" datetime="2020-12-03T05:23:42+00:00">2020-12-03</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <ol>
<li>Ctrl + F搜索</li>
<li>Ctrl + Shit + F全局搜素</li>
<li>Ctrl + G输入行号可以跳转到指定的行</li>
<li>Ctrl + N新建文件</li>
<li>Ctrl + Shift + P打开命令输入框<br>输入language输入想要的语言</li>
<li>Ctrl + Shift + P打开命令面板<br>输入encoding字符编码</li>
<li>支持markdown的书写和预览<br>Ctrl + Shift + V预览</li>
<li>Ctrl + Tab键来快速的切换文件</li>
<li>Ctrl + p输入搜索文件</li>
</ol>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="gongxicheng.cn/2016/10/12/before2020/2016-10-12-travis/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="Gary Gong">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="恭喜">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2016/10/12/before2020/2016-10-12-travis/" class="post-title-link" itemprop="url">travis</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2016-10-12 00:24:02" itemprop="dateCreated datePublished" datetime="2016-10-12T00:24:02+00:00">2016-10-12</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-12-03 05:23:42" itemprop="dateModified" datetime="2020-12-03T05:23:42+00:00">2020-12-03</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h1 id="Travis-部署"><a href="#Travis-部署" class="headerlink" title="Travis 部署"></a>Travis 部署</h1><p>忙乎到半夜 Travis 总算部署成功了，这一篇留着记录下部署过程中的问题。</p>
<h1 id="Travis-下载"><a href="#Travis-下载" class="headerlink" title="Travis 下载"></a>Travis 下载</h1><p>因为众所周知的原因，某些网站是访问不了的。所以下载ruby的 gem就不那么轻松，然后在安装travis的时候又访问不了，所以就在找国内的源，<br>然而https的因为证书问题有没有加进去，所以最后 使用了 ‘<a href="http://gems.ruby-china.org&#39;" target="_blank" rel="noopener">http://gems.ruby-china.org&#39;</a> 使用了这个</p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  


  
  <nav class="pagination">
    <a class="extend prev" rel="prev" href="/page/2/"><i class="fa fa-angle-left" aria-label="上一页"></i></a><a class="page-number" href="/">1</a><a class="page-number" href="/page/2/">2</a><span class="page-number current">3</span><a class="page-number" href="/page/4/">4</a><a class="extend next" rel="next" href="/page/4/"><i class="fa fa-angle-right" aria-label="下一页"></i></a>
  </nav>



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">Gary Gong</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">31</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">2</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">17</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/darktutu" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;darktutu" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Gary Gong</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>




  















  

  

</body>
</html>
